package org.jianfa.rpc.server.service;

import org.jianfa.learn.common.service.IUserService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class UserServiceImpl implements IUserService {

    @Value("${netty.port}")
    private Integer nettyPort;

    //将来客户单要远程调用的方法
    public String sayHello(String msg) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
        String date = sdf.format(new Date());
        System.out.println(date + " : " + "客户端发送数据 : "+msg);
        return String.format("服务器%d返回数据: %s", nettyPort, msg);
    }
}
